package com.nineclock.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nineclock.pojo.SysRole;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysRoleMapper extends BaseMapper<SysRole> {
    @Select("select r.* from sys_company_user cu,sys_company_user_role cur,sys_role r where cu.id = cur.company_user_id and " +
            "cur.role_id = r.id and cu.user_id = #{userId} and cu.company_id = #{companyId}")
    public List<SysRole> findRoleByUserIdAndCompanyId(@Param("userId") Long userId, @Param("companyId") Long companyId);
}
